package com.hippomeetsskunk.savanna.types.world;

public class Weather {

	public enum WeatherType{
		Sunny,
		Cloudy,
		Overcast,
		Rainy,
		Snowy,
		Hail
	}
	
	private double tAvg;
	private double tDiff;
	private double h;
	
	public Weather(double temperature, double temperatureDayNightDifference, double humidity){
		tAvg = temperature;
		tDiff = temperatureDayNightDifference;
		h = humidity;
	}

	public void setWeather(double temperature, double temperatureDayNightDifference, double humidity){
		this.tAvg = temperature;
		this.tDiff = temperatureDayNightDifference;
		this.h = humidity;
	}
	
	public double getMaxT(){
		return tAvg + 0.5 * tDiff;
	}
	
	public double getMinT(){
		return tAvg - 0.5 * tDiff;
	}
	
	public double getT(){
		return tAvg;
	}
	
	public WeatherType getWeather(){
		if (h < 0.4) return WeatherType.Sunny;
		if (h < 0.7) return WeatherType.Cloudy;
		if (tAvg < 3.2 && tAvg >= 3.0) return WeatherType.Hail;
		if (tAvg < 3.0) return WeatherType.Snowy;
		return WeatherType.Rainy;
	}

	public double getH() {
		return h;
	}
}
